/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('dtsrs', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ConfigureMigrationJobRequest {
  destinationEndpoint?: {
    dataBaseName?: string(name='DataBaseName'),
    engineName?: string(name='EngineName'),
    instanceID?: string(name='InstanceID'),
    instanceType?: string(name='InstanceType'),
    password?: string(name='Password'),
    port?: string(name='Port'),
    region?: string(name='Region'),
    userName?: string(name='UserName'),
  }(name='DestinationEndpoint'),
  migrationMode?: {
    dataIntialization?: boolean(name='DataIntialization'),
    dataSynchronization?: boolean(name='DataSynchronization'),
    structureIntialization?: boolean(name='StructureIntialization'),
  }(name='MigrationMode'),
  sourceEndpoint?: {
    databaseName?: string(name='DatabaseName'),
    engineName?: string(name='EngineName'),
    IP?: string(name='IP'),
    instanceID?: string(name='InstanceID'),
    instanceType?: string(name='InstanceType'),
    oracleSID?: string(name='OracleSID'),
    password?: string(name='Password'),
    port?: string(name='Port'),
    region?: string(name='Region'),
    userName?: string(name='UserName'),
  }(name='SourceEndpoint'),
  migrationJobId?: string(name='MigrationJobId'),
  migrationJobName?: string(name='MigrationJobName'),
  migrationObject?: string(name='MigrationObject'),
}

model ConfigureMigrationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  success?: string(name='Success'),
}

model ConfigureMigrationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ConfigureMigrationJobResponseBody(name='body'),
}

async function configureMigrationJobWithOptions(request: ConfigureMigrationJobRequest, runtime: Util.RuntimeOptions): ConfigureMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobId)) {
    query['MigrationJobId'] = request.migrationJobId;
  }
  if (!Util.isUnset(request.migrationJobName)) {
    query['MigrationJobName'] = request.migrationJobName;
  }
  if (!Util.isUnset(request.migrationObject)) {
    query['MigrationObject'] = request.migrationObject;
  }
  if (!Util.isUnset(request.destinationEndpoint)) {
    query['DestinationEndpoint'] = request.destinationEndpoint;
  }
  if (!Util.isUnset(request.migrationMode)) {
    query['MigrationMode'] = request.migrationMode;
  }
  if (!Util.isUnset(request.sourceEndpoint)) {
    query['SourceEndpoint'] = request.sourceEndpoint;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConfigureMigrationJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function configureMigrationJob(request: ConfigureMigrationJobRequest): ConfigureMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return configureMigrationJobWithOptions(request, runtime);
}

model CreateMigrationJobRequest {
  clientToken?: string(name='ClientToken'),
  migrationJobClass?: string(name='MigrationJobClass'),
  region?: string(name='Region'),
}

model CreateMigrationJobResponseBody = {
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  migrationJobId?: string(name='MigrationJobId'),
  success?: string(name='Success'),
}

model CreateMigrationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateMigrationJobResponseBody(name='body'),
}

async function createMigrationJobWithOptions(request: CreateMigrationJobRequest, runtime: Util.RuntimeOptions): CreateMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.migrationJobClass)) {
    query['MigrationJobClass'] = request.migrationJobClass;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateMigrationJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createMigrationJob(request: CreateMigrationJobRequest): CreateMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return createMigrationJobWithOptions(request, runtime);
}

model CreateSynchronousJobRequest {
  destinationInstanceId?: string(name='DestinationInstanceId'),
  fullDataIntialization?: boolean(name='FullDataIntialization'),
  sourceInstanceId?: string(name='SourceInstanceId'),
  structureIntialization?: boolean(name='StructureIntialization'),
  synchronousJobName?: string(name='SynchronousJobName'),
  synchronousObjectList?: string(name='SynchronousObjectList'),
  synchronousSpeedLimit?: string(name='SynchronousSpeedLimit'),
}

model CreateSynchronousJobResponseBody = {
  synchronousJobId?: string(name='SynchronousJobId'),
}

model CreateSynchronousJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSynchronousJobResponseBody(name='body'),
}

async function createSynchronousJobWithOptions(request: CreateSynchronousJobRequest, runtime: Util.RuntimeOptions): CreateSynchronousJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.destinationInstanceId)) {
    query['DestinationInstanceId'] = request.destinationInstanceId;
  }
  if (!Util.isUnset(request.fullDataIntialization)) {
    query['FullDataIntialization'] = request.fullDataIntialization;
  }
  if (!Util.isUnset(request.sourceInstanceId)) {
    query['SourceInstanceId'] = request.sourceInstanceId;
  }
  if (!Util.isUnset(request.structureIntialization)) {
    query['StructureIntialization'] = request.structureIntialization;
  }
  if (!Util.isUnset(request.synchronousJobName)) {
    query['SynchronousJobName'] = request.synchronousJobName;
  }
  if (!Util.isUnset(request.synchronousObjectList)) {
    query['SynchronousObjectList'] = request.synchronousObjectList;
  }
  if (!Util.isUnset(request.synchronousSpeedLimit)) {
    query['SynchronousSpeedLimit'] = request.synchronousSpeedLimit;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSynchronousJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSynchronousJob(request: CreateSynchronousJobRequest): CreateSynchronousJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSynchronousJobWithOptions(request, runtime);
}

model DeleteMigrationJobRequest {
  migrationJobId?: string(name='MigrationJobId'),
}

model DeleteMigrationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function deleteMigrationJobWithOptions(request: DeleteMigrationJobRequest, runtime: Util.RuntimeOptions): DeleteMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobId)) {
    query['MigrationJobId'] = request.migrationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteMigrationJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteMigrationJob(request: DeleteMigrationJobRequest): DeleteMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteMigrationJobWithOptions(request, runtime);
}

model DeleteSynchronousJobRequest {
  synchronousJobId?: string(name='SynchronousJobId'),
}

model DeleteSynchronousJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function deleteSynchronousJobWithOptions(request: DeleteSynchronousJobRequest, runtime: Util.RuntimeOptions): DeleteSynchronousJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.synchronousJobId)) {
    query['SynchronousJobId'] = request.synchronousJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSynchronousJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function deleteSynchronousJob(request: DeleteSynchronousJobRequest): DeleteSynchronousJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSynchronousJobWithOptions(request, runtime);
}

model DescirbeMigrationJobsRequest {
  migrationJobName?: string(name='MigrationJobName'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
}

model DescirbeMigrationJobsResponseBody = {
  migrationJobs?: {
    migrationJob?: [ 
    {
      dataInitialization?: {
        errorMessage?: string(name='ErrorMessage'),
        percent?: string(name='Percent'),
        progress?: string(name='Progress'),
        status?: string(name='status'),
      }(name='DataInitialization'),
      dataSynchronization?: {
        delay?: string(name='Delay'),
        errorMessage?: string(name='ErrorMessage'),
        percent?: string(name='Percent'),
        status?: string(name='status'),
      }(name='DataSynchronization'),
      destinationEndpoint?: {
        databaseName?: string(name='DatabaseName'),
        engineName?: string(name='EngineName'),
        IP?: string(name='IP'),
        instanceID?: string(name='InstanceID'),
        instanceType?: string(name='InstanceType'),
        oracleSID?: string(name='OracleSID'),
        port?: string(name='Port'),
        userName?: string(name='UserName'),
      }(name='DestinationEndpoint'),
      migrationJobClass?: string(name='MigrationJobClass'),
      migrationJobID?: string(name='MigrationJobID'),
      migrationJobName?: string(name='MigrationJobName'),
      migrationJobStatus?: string(name='MigrationJobStatus'),
      migrationMode?: {
        dataInitialization?: boolean(name='DataInitialization'),
        dataSynchronization?: boolean(name='DataSynchronization'),
        structureInitialization?: boolean(name='StructureInitialization'),
      }(name='MigrationMode'),
      migrationObject?: {
        synchronousObject?: [ 
        {
          databaseName?: string(name='DatabaseName'),
          tableList?: {
            table?: [ string ](name='Table')
          }(name='TableList'),
          wholeDatabase?: string(name='WholeDatabase'),
        }
      ](name='SynchronousObject')
      }(name='MigrationObject'),
      payType?: string(name='PayType'),
      precheck?: {
        percent?: string(name='Percent'),
        status?: string(name='Status'),
      }(name='Precheck'),
      sourceEndpoint?: {
        databaseName?: string(name='DatabaseName'),
        engineName?: string(name='EngineName'),
        IP?: string(name='IP'),
        instanceID?: string(name='InstanceID'),
        instanceType?: string(name='InstanceType'),
        oracleSID?: string(name='OracleSID'),
        port?: string(name='Port'),
        userName?: string(name='UserName'),
      }(name='SourceEndpoint'),
      structureInitialization?: {
        errorMessage?: string(name='ErrorMessage'),
        percent?: string(name='Percent'),
        progress?: string(name='Progress'),
        status?: string(name='status'),
      }(name='StructureInitialization'),
    }
  ](name='MigrationJob')
  }(name='MigrationJobs'),
  pageNumber?: int32(name='PageNumber'),
  pageRecordCount?: int32(name='PageRecordCount'),
  totalRecordCount?: long(name='TotalRecordCount'),
}

model DescirbeMigrationJobsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescirbeMigrationJobsResponseBody(name='body'),
}

async function descirbeMigrationJobsWithOptions(request: DescirbeMigrationJobsRequest, runtime: Util.RuntimeOptions): DescirbeMigrationJobsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobName)) {
    query['MigrationJobName'] = request.migrationJobName;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescirbeMigrationJobs',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function descirbeMigrationJobs(request: DescirbeMigrationJobsRequest): DescirbeMigrationJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  return descirbeMigrationJobsWithOptions(request, runtime);
}

model DescribeMigrationJobStatusRequest {
  migrationJobId?: string(name='MigrationJobId'),
}

model DescribeMigrationJobStatusResponseBody = {
  dataInitializationStatus?: {
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    progress?: string(name='Progress'),
    status?: string(name='Status'),
  }(name='DataInitializationStatus'),
  dataSynchronizationStatus?: {
    delay?: string(name='Delay'),
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    status?: string(name='Status'),
  }(name='DataSynchronizationStatus'),
  destinationEndpoint?: {
    databaseName?: string(name='DatabaseName'),
    engineName?: string(name='EngineName'),
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    port?: string(name='Port'),
    userName?: string(name='UserName'),
    oracleSID?: string(name='oracleSID'),
  }(name='DestinationEndpoint'),
  migrationJobClass?: string(name='MigrationJobClass'),
  migrationJobId?: string(name='MigrationJobId'),
  migrationJobName?: string(name='MigrationJobName'),
  migrationJobStatus?: string(name='MigrationJobStatus'),
  migrationMode?: {
    dataInitialization?: boolean(name='dataInitialization'),
    dataSynchronization?: boolean(name='dataSynchronization'),
    structureInitialization?: boolean(name='structureInitialization'),
  }(name='MigrationMode'),
  migrationObject?: string(name='MigrationObject'),
  payType?: string(name='PayType'),
  precheckStatus?: {
    detail?: {
      checkItem?: [ 
      {
        checkStatus?: string(name='CheckStatus'),
        errorMessage?: string(name='ErrorMessage'),
        itemName?: string(name='ItemName'),
        repairMethod?: string(name='RepairMethod'),
      }
    ](name='CheckItem')
    }(name='Detail'),
    percent?: string(name='Percent'),
    status?: string(name='Status'),
  }(name='PrecheckStatus'),
  sourceEndpoint?: {
    databaseName?: string(name='DatabaseName'),
    engineName?: string(name='EngineName'),
    IP?: string(name='IP'),
    instanceId?: string(name='InstanceId'),
    instanceType?: string(name='InstanceType'),
    port?: string(name='Port'),
    userName?: string(name='UserName'),
    oracleSID?: string(name='oracleSID'),
  }(name='SourceEndpoint'),
  structureInitializationStatus?: {
    errorMessage?: string(name='ErrorMessage'),
    percent?: string(name='Percent'),
    progress?: string(name='Progress'),
    status?: string(name='Status'),
  }(name='StructureInitializationStatus'),
}

model DescribeMigrationJobStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeMigrationJobStatusResponseBody(name='body'),
}

async function describeMigrationJobStatusWithOptions(request: DescribeMigrationJobStatusRequest, runtime: Util.RuntimeOptions): DescribeMigrationJobStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobId)) {
    query['MigrationJobId'] = request.migrationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeMigrationJobStatus',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeMigrationJobStatus(request: DescribeMigrationJobStatusRequest): DescribeMigrationJobStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeMigrationJobStatusWithOptions(request, runtime);
}

model DescribeSynchronousJobConfigurationRequest {
  synchronousJobId?: string(name='SynchronousJobId'),
}

model DescribeSynchronousJobConfigurationResponseBody = {
  createTime?: string(name='CreateTime'),
  destinationDBType?: string(name='DestinationDBType'),
  destinationInstanceId?: string(name='DestinationInstanceId'),
  fullDataIntialization?: string(name='FullDataIntialization'),
  sourceDBType?: string(name='SourceDBType'),
  sourceInstanceId?: string(name='SourceInstanceId'),
  structureIntialization?: string(name='StructureIntialization'),
  synchronousJobId?: string(name='SynchronousJobId'),
  synchronousJobName?: string(name='SynchronousJobName'),
  synchronousObjectList?: {
    synchronousObject?: [ 
    {
      databaseName?: string(name='DatabaseName'),
      tableList?: {
        table?: [ string ](name='Table')
      }(name='TableList'),
      wholeDatabase?: string(name='WholeDatabase'),
    }
  ](name='SynchronousObject')
  }(name='SynchronousObjectList'),
  synchronousSpeedLimit?: string(name='SynchronousSpeedLimit'),
}

model DescribeSynchronousJobConfigurationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronousJobConfigurationResponseBody(name='body'),
}

async function describeSynchronousJobConfigurationWithOptions(request: DescribeSynchronousJobConfigurationRequest, runtime: Util.RuntimeOptions): DescribeSynchronousJobConfigurationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.synchronousJobId)) {
    query['SynchronousJobId'] = request.synchronousJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronousJobConfiguration',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronousJobConfiguration(request: DescribeSynchronousJobConfigurationRequest): DescribeSynchronousJobConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronousJobConfigurationWithOptions(request, runtime);
}

model DescribeSynchronousJobDetailsRequest {
  synchronousJobId?: string(name='SynchronousJobId'),
}

model DescribeSynchronousJobDetailsResponseBody = {
  createTime?: string(name='CreateTime'),
  delaySecond?: string(name='DelaySecond'),
  destinationInstanceId?: string(name='DestinationInstanceId'),
  errorMessage?: string(name='ErrorMessage'),
  fullDataIntializatioPercent?: string(name='FullDataIntializatioPercent'),
  fullDataIntializatioProgress?: string(name='FullDataIntializatioProgress'),
  fullDataIntializationStatus?: string(name='FullDataIntializationStatus'),
  incrementDataIntializatioDelay?: string(name='IncrementDataIntializatioDelay'),
  incrementDataIntializatioPercent?: string(name='IncrementDataIntializatioPercent'),
  incrementDataIntializationStatus?: string(name='IncrementDataIntializationStatus'),
  precheckDetails?: {
    precheckDetail?: [ 
    {
      checkItem?: string(name='CheckItem'),
      checkItemDescription?: string(name='CheckItemDescription'),
      checkResult?: string(name='CheckResult'),
      failedReson?: string(name='FailedReson'),
      repairMethod?: string(name='RepairMethod'),
    }
  ](name='PrecheckDetail')
  }(name='PrecheckDetails'),
  precheckPercent?: string(name='PrecheckPercent'),
  precheckStatus?: string(name='PrecheckStatus'),
  sourceInstanceId?: string(name='SourceInstanceId'),
  structureIntializationPercent?: string(name='StructureIntializationPercent'),
  structureIntializationProgress?: string(name='StructureIntializationProgress'),
  structureIntializationStatus?: string(name='StructureIntializationStatus'),
  synchronousFlow?: string(name='SynchronousFlow'),
  synchronousJobId?: string(name='SynchronousJobId'),
  synchronousJobName?: string(name='SynchronousJobName'),
  synchronousStatus?: string(name='SynchronousStatus'),
  synchronousTPS?: string(name='SynchronousTPS'),
}

model DescribeSynchronousJobDetailsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronousJobDetailsResponseBody(name='body'),
}

async function describeSynchronousJobDetailsWithOptions(request: DescribeSynchronousJobDetailsRequest, runtime: Util.RuntimeOptions): DescribeSynchronousJobDetailsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.synchronousJobId)) {
    query['SynchronousJobId'] = request.synchronousJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronousJobDetails',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronousJobDetails(request: DescribeSynchronousJobDetailsRequest): DescribeSynchronousJobDetailsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronousJobDetailsWithOptions(request, runtime);
}

model DescribeSynchronousJobListRequest {
  instanceId?: string(name='InstanceId'),
  pageNum?: int32(name='PageNum'),
  pageSize?: int32(name='PageSize'),
  synchronousJobName?: string(name='SynchronousJobName'),
}

model DescribeSynchronousJobListResponseBody = {
  pageNumber?: int32(name='PageNumber'),
  pageRecordCount?: int32(name='PageRecordCount'),
  synchronousJobList?: {
    synchronousJob?: [ 
    {
      delaySecond?: string(name='DelaySecond'),
      destinationInstanceId?: string(name='DestinationInstanceId'),
      errorMessage?: string(name='ErrorMessage'),
      fullDataIntializatioPercent?: string(name='FullDataIntializatioPercent'),
      fullDataIntializatioProgress?: string(name='FullDataIntializatioProgress'),
      fullDataIntializationStatus?: string(name='FullDataIntializationStatus'),
      incrementDataIntializatioDelay?: string(name='IncrementDataIntializatioDelay'),
      incrementDataIntializatioPercent?: string(name='IncrementDataIntializatioPercent'),
      incrementDataIntializationStatus?: string(name='IncrementDataIntializationStatus'),
      sourceInstanceId?: string(name='SourceInstanceId'),
      structureIntializationPercent?: string(name='StructureIntializationPercent'),
      structureIntializationProgress?: string(name='StructureIntializationProgress'),
      structureIntializationStatus?: string(name='StructureIntializationStatus'),
      synchronousFlow?: string(name='SynchronousFlow'),
      synchronousJobId?: string(name='SynchronousJobId'),
      synchronousJobName?: string(name='SynchronousJobName'),
      synchronousStatus?: string(name='SynchronousStatus'),
      synchronousTPS?: string(name='SynchronousTPS'),
    }
  ](name='SynchronousJob')
  }(name='SynchronousJobList'),
  totalRecordCount?: long(name='TotalRecordCount'),
}

model DescribeSynchronousJobListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeSynchronousJobListResponseBody(name='body'),
}

async function describeSynchronousJobListWithOptions(request: DescribeSynchronousJobListRequest, runtime: Util.RuntimeOptions): DescribeSynchronousJobListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNum)) {
    query['PageNum'] = request.pageNum;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.synchronousJobName)) {
    query['SynchronousJobName'] = request.synchronousJobName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSynchronousJobList',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSynchronousJobList(request: DescribeSynchronousJobListRequest): DescribeSynchronousJobListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSynchronousJobListWithOptions(request, runtime);
}

model StartMigrationJobRequest {
  migrationJobId?: string(name='MigrationJobId'),
}

model StartMigrationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function startMigrationJobWithOptions(request: StartMigrationJobRequest, runtime: Util.RuntimeOptions): StartMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobId)) {
    query['MigrationJobId'] = request.migrationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartMigrationJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function startMigrationJob(request: StartMigrationJobRequest): StartMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return startMigrationJobWithOptions(request, runtime);
}

model StartSynchronousJobRequest {
  synchronousJobId?: string(name='SynchronousJobId'),
}

model StartSynchronousJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function startSynchronousJobWithOptions(request: StartSynchronousJobRequest, runtime: Util.RuntimeOptions): StartSynchronousJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.synchronousJobId)) {
    query['SynchronousJobId'] = request.synchronousJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartSynchronousJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function startSynchronousJob(request: StartSynchronousJobRequest): StartSynchronousJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return startSynchronousJobWithOptions(request, runtime);
}

model StopMigrationJobRequest {
  migrationJobId?: string(name='MigrationJobId'),
}

model StopMigrationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function stopMigrationJobWithOptions(request: StopMigrationJobRequest, runtime: Util.RuntimeOptions): StopMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobId)) {
    query['MigrationJobId'] = request.migrationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopMigrationJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function stopMigrationJob(request: StopMigrationJobRequest): StopMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopMigrationJobWithOptions(request, runtime);
}

model SuspendMigrationJobRequest {
  migrationJobId?: string(name='MigrationJobId'),
}

model SuspendMigrationJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function suspendMigrationJobWithOptions(request: SuspendMigrationJobRequest, runtime: Util.RuntimeOptions): SuspendMigrationJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.migrationJobId)) {
    query['MigrationJobId'] = request.migrationJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SuspendMigrationJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function suspendMigrationJob(request: SuspendMigrationJobRequest): SuspendMigrationJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return suspendMigrationJobWithOptions(request, runtime);
}

model SuspendSynchronousJobRequest {
  synchronousJobId?: string(name='SynchronousJobId'),
}

model SuspendSynchronousJobResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
}

async function suspendSynchronousJobWithOptions(request: SuspendSynchronousJobRequest, runtime: Util.RuntimeOptions): SuspendSynchronousJobResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.synchronousJobId)) {
    query['SynchronousJobId'] = request.synchronousJobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SuspendSynchronousJob',
    version = '2015-11-24',
    protocol = 'HTTP',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'none',
  };
  return callApi(params, req, runtime);
}

async function suspendSynchronousJob(request: SuspendSynchronousJobRequest): SuspendSynchronousJobResponse {
  var runtime = new Util.RuntimeOptions{};
  return suspendSynchronousJobWithOptions(request, runtime);
}

